2 Problem: 11385 - Da Vinci Code
3 Author: Andrés Mejía-Posada
5 Que gonorrea de problema.
30 #define D(x) cout << #x " is " << x << endl
34 int binary_search(int what
, const vector
<int> &where
){
36 int low
= 0, high
= n
- 1;
38 int mid
= (low
+ high
) / 2;
39 if (where
[mid
] < what
){
45 if (where
[low
] != what
) return -1;
52 while (fib
[fib
.size()-1] + fib
[fib
.size()-2] > 0){ //Before overflow
53 fib
.push_back(fib
[fib
.size()-1] + fib
[fib
.size()-2]);
61 for (int i
=0; i
<n
; ++i
) cin
>> nums
[i
];
66 for (int i
=0; i
<s
.size(); ++i
)
73 for (int i
=0; i
<n
; ++i
){
74 pos
[i
] = binary_search(nums
[i
], fib
);
77 string
ans( *(max_element(pos
.begin(), pos
.end())) + 1, ' ');
79 for (int i
=min(s
.size(), pos
.size()) - 1; i
>= 0; --i
){